﻿@model VietPremier.Areas.AdminCP.Models.AdminUserManager
@{
    ViewBag.Title = "Insert";
    Layout = "~/Areas/AdminCP/Views/Shared/AdminLayout.cshtml";
}

<script src="@Url.Content("~/Content/cssAdmin/js/plugins/jquery-1.7.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/cssAdmin/js/plugins/jquery-ui-1.8.16.custom.min.js")" type="text/javascript"></script>
<script type="text/javascript" src="@Url.Content("~/ckeditor/ckeditor.js")"></script>
<script type="text/javascript" src="@Url.Content("~/ckfinder/ckfinder.js")"></script>

<script type="text/javascript">
    jQuery(document).ready(function () {
        $('#nofSuccess').hide(); // an thong bao
        $('#nofError').hide();

        readyValue();
    });
    function getParameterByName(name) {
        name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
        var regexS = "[\\?&]" + name + "=([^&#]*)";
        var regex = new RegExp(regexS);
        var results = regex.exec(window.location.search);
        if (results == null)
            return "";
        else
            return decodeURIComponent(results[1].replace(/\+/g, " "));
    }
    function readyValue() {
        
    }
    function CopyInformation() {
  
    }
    function alertMsg(msg) {
        $('#nofSuccess').hide();
        $('#nofError').show();
        $('#msgNofError').text(msg);
    }
    function getFileExtension(filename) {
        var ext = /^.+\.([^.]+)$/.exec(filename);
        return ext == null ? "" : ext[1];
    }
    function is_int(value) {
        for (i = 0; i < value.length; i++) {
            if ((value.charAt(i) < '0') || (value.charAt(i) > '9')) return false
        }
        return true;
    }
    function removeColorBox() {
        //tra ve mau trang thai cu        
        $("#Username").css("border", "1px solid #ccc");
        $("#Password").css("border", "1px solid #ccc");
        return false;
    }
    function checkField() {

        removeColorBox();

        //check Name
        var Name = $("#Username").val();
        if (Name.length < 2 || Name.length > 100) {
            msg = "Username must have at most [2,100] characters.";
            decoded = $('<div/>').html(msg).text();
            alertMsg(decoded);
            alert(decoded);
            $("#Username").css("border", "1px solid red");
            $("#Username").focus();
            return false;
        }

        //check Description
        var Review = $("#Password").val();
        if (Review.length < 2) {
            msg = "Password cannot be empty.";
            decoded = $('<div/>').html(msg).text();
            alertMsg(decoded);
            alert(decoded);
            $("#Password").css("border", "1px solid red");
            $("#Password").focus();
            return false;
        }

        //return false;
        return confirm("Are you sure you want to save?");

    }

</script>

<div class="maincontentinner">
    <ul class="maintabmenu">
        <li class="current"><a href="@Url.Action("Index", "AdminUserManager")">Quản lý tài khoản</a></li>
        <li class="current"><a href="@Url.Action("Insert", "AdminUserManager")">Thêm tài khoản mới</a></li>
    </ul>
    <!--maintabmenu-->
    <div class="notification msgsuccess" style="display: none" id="nofSuccess">
        <a class="close"></a>
        <p id="msgNofSuccess">This is a success message.</p>
    </div>
    <!-- notification msgsuccess -->

    <div class="notification msgerror" style="display: none" id="nofError">
        <a class="close"></a>
        <p id="msgNofError">This is an error message.</p>
    </div>
    <!-- notification msgerror -->

    <form id="form" class="stdform stdform2" method="post" action="#" enctype="multipart/form-data">

        <div class="contenttitle radiusbottom0">
            <h2 class="table"><span>Thêm tài khoản mới</span></h2>
        </div>
        <!--contenttitle-->

        <p>
            <label>Username</label>
            <span class="field">
                <input type="text" name="Username" id="Username" class="longinput" />
            </span>
        </p>

        <p>
            <label>Password</label>
            <span class="field">
                <input type="text" name="Password" id="Password" class="longinput" />
            </span>
        </p>

        <p>
            <label>Loại tài khoản</label>
            <span class="field">
             <select id="Type" name="Type">
                 <option value="Manager">Manager</option>
                 <option value="User">User</option>
             </select>
            </span>
        </p>

        <p class="stdformbutton">
            <input type="submit" value="Accept" onclick="return checkField()" />
            <input type="submit" value="Back" onclick="javascript: history.back(); return false" />
        </p>

    </form>

    <br clear="all" />
</div>
<!--maincontentinner-->
